package com.lzwork.gpt.utility.batchjob.inner;

import com.lzwork.web.RemoteCaller;
import com.lzwork.web.RemoteCaller.CallResult;
import com.lzwork.web.data.BoolResultInfo;

/**
 * @author LiZheng
 * @date 2024年7月17日 11:01:56
 */

public interface JobParserRemote
{
	String serverUrl();
	
	boolean disconnect();

	public default BoolResultInfo validateServer()
	{
		RemoteCaller caller = new RemoteCaller();
		CallResult cr = caller.get(serverUrl(), null);

		Exception ex = cr.getException();
		if (ex != null)
		{
			String msg = "Server error " + cr.getCode() + ": " + ex.getMessage();
			return BoolResultInfo.makeFalse(msg);
		}

		return BoolResultInfo.makeTrue("");
	}
}
